<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/2/9
 * Time: 11:05
 */

namespace Home\Controller;


class ServiceController extends HomeController
{
    public function index(){
        $cid=I("get.cid",74,"int");
        $document=D("Document");
        $list=$document->lists($cid);
        foreach($list as $key =>$val){
             if($val['id']!=579){
                 $list[$key]['son']=$document->sub_document($val['id']);
             }
        }
        $this->assign("list",$list);
        $this->assign("meta_title","服务项目");
        /*模板参数*/
        $template['template']=I("get.template",null,"addslashes");
        $template['id']=I("get.template_id",null,"int");
        $this->assign("template",$template);
        $id=I("get.id",583,"int");
        $this->assign("id",$id);
        $this->display();
    }
    public function place(){
        /*网页位址*/
        $id=I("get.id",628,"int");
        $document=D("Document");
        $title1=$document->detail($id);
        $title2=$document->detail($title1['pid']);
        $title='您的位置 :'.
            '<a href="/">首页</a> &gt;&gt;'.
            '<a>'.$title2['title'].'</a> &gt;&gt;'.
            '<a class="on">'.$title1['title'].'</a>';
        echo $title;exit;
    }
    public function lists(){
        $id=I("get.id",0,"int");
        $document=D("Document");
        $img_list=$document->sub_document_page($id,4);
        $this->assign("img_list",$img_list);
        //print_r($img_list);exit;
        $this->display();
    }
    public function info(){
       $id=I("get.id",583,"int");
       $document=D("Document");
       $detail_data = $document->detail($id);
       $this->assign("detail_data",$detail_data);
       $this->display();
    }
    public function detail(){
        $id=I("get.id",583,"int");
        $document=D("Document");
        $detail_data = $document->detail($id);
        $this->assign("detail_data",$detail_data);
        $this->display();
    }
}